<template>
    <van-nav-bar title="首页" left-text="" left-arrow @click-left="() => { $router.push('/login') }" fixed />
    <div style="height: 50px;"></div>
    <!-- 搜素 -->
    <van-search v-model="value" shape="round" background="red" placeholder="请输入搜索关键词" @click="search"/>
    <!-- 轮播 -->
    <swiper></swiper>
    <!-- 宫格 -->
    <van-grid :column-num="4">
        <van-grid-item v-for="item  in navDate" :key="value" :icon="item.image_src" :text="item.name" />
    </van-grid>
    <div v-for="item in floorDate">
        <img style="width:100%;" :src="item.floor_title.image_src" alt="">
        <div v-for="items in item.product_list" style="float: left;">
            <img style="width: 120px;height: 120px;" :src="items.image_src" alt="">
        </div>
    </div>
</template>

<script setup>
import swiper from '@/components/swiper.vue'
import { NavApi } from '@/api/api'
import {ref} from 'vue'
let navDate = ref([])
NavApi().then(res => {
    console.log('宫格数据', res)
    navDate.value = res.data.message
})
import {floorApi} from '@/api/api'
let floorDate=ref([])
floorApi().then(res=>{
    console.log('楼层数据',res)
    floorDate.value=res.data.message
})
import {useRouter} from 'vue-router'
let router=new useRouter()
const search=()=>{
    router.push('/search')
}
</script>

<style lang="scss" scoped></style>